package com.itheima.stock.mapper;

import com.itheima.stock.domain.InnerMarketDomain;
import com.itheima.stock.pojo.StockMarketIndexInfo;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* @author GAQ
* @description 针对表【stock_market_index_info(国内大盘数据详情表)】的数据库操作Mapper
* @createDate 2022-05-30
* @Entity com.itheima.stock.pojo.StockMarketIndexInfo
*/
public interface StockMarketIndexInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockMarketIndexInfo record);

    int insertSelective(StockMarketIndexInfo record);

    StockMarketIndexInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockMarketIndexInfo record);

    int updateByPrimaryKey(StockMarketIndexInfo record);

    /**
     * 根据大盘的编码和时间点查询数据
     * @param marketCodes 大盘编码集合
     * @param timePoint 时间点，精确到分钟
     * @return
     */
    List<InnerMarketDomain> getInnerMarketInfosByCodesAndTime(@Param("timePoint") Date timePoint, @Param("marketCodes") List<String> marketCodes);


    /**
     * 统计指定大盘下指定日期时间范围内的成交量信息
     * @param startTime 起始时间
     * @param endTime 截止时间
     * @param marketCodes 大盘的编码
     * @return
     */
    List<Map> getAmountInfoByRangeTime(@Param("startTime") Date startTime,
                                       @Param("endTime") Date endTime,
                                       @Param("marketCodes") List<String> marketCodes);

    /**
     * 批量插入
     * @param list
     * @return
     */
    int insertBatch(@Param("list") ArrayList<StockMarketIndexInfo> list);
}
